package com.youdoneed.community.group.dao;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.youdoneed.community.group.entity.Forumgroup;
import com.youdoneed.community.group.vo.ForumInUserGroupVo;
import com.youdoneed.community.group.vo.ForumgroupInUserVo;
@Mapper
public interface ForumgroupMapper {
    int deleteByPrimaryKey(String forumGroupId);

    int insert(Forumgroup record);

    int insertSelective(Forumgroup record);

    Forumgroup selectByPrimaryKey(String forumGroupId);

    int updateByPrimaryKeySelective(Forumgroup record);

    int updateByPrimaryKey(Forumgroup record);
    
    List<Forumgroup> getMyGroups(@Param("userId")String userId,@Param("groupType")String groupType);
    
    int deleteByUserIdAndGroupId(@Param("leaderId")String leaderId,@Param("forumGroupId")String forumGroupId);
    
    int updateByPrimaryKeyForprivacy(@Param("forumGroupId")String forumGroupId,@Param("groupName")String groupName,
    								 @Param("groupIntroduction")String groupIntroduction,@Param("privacySetting")Integer privacySetting,
    								 @Param("longitude")Double longitude,@Param("latitude")Double latitude,
    								 @Param("groupStyle") String groupStyle,@Param("address") String address);
    
    
    List<ForumInUserGroupVo> selectByGroupName(@Param("userId")String userId,@Param("groupName")String groupName);
    
    List<Forumgroup> selectGroupByNameAndDate(@Param("groupName")String groupName,@Param("privacy")Integer privacy,@Param("createDateS")String createDateS,@Param("createDateE")String createDateE);
    
    ForumgroupInUserVo findForumgroupDetails(String forumGroupId);
    
    List<ForumInUserGroupVo> selectNearbyGroups(Double minLongitude, Double maxLongitude,Double minLatitude, Double maxLatitude,String userId,Double Longitude,Double latitude,Integer distance,Integer privacySetting);
    
    List<Forumgroup> selectForumgroup(@Param("groupName")String groupName,@Param("leaderUserName")String leaderUserName,@Param("groupType")String groupType,
    								  @Param("groupStyle")String groupStyle,@Param("memberCountMin")Integer memberCountMin,@Param("memberCountMax")Integer memberCountMax,
    								  @Param("groupMessageTotalMin")Integer groupMessageTotalMin,@Param("groupMessageTotalMax")Integer groupMessageTotalMax,
    								  @Param("createDateS")String createDateS,@Param("createDateE")String createDateE);
    
    int countGroupByUserId(@Param("userId")String userId,@Param("groupType")String groupType);
    
    
    int countForumgroupTotal(@Param("groupName")String groupName,@Param("leaderUserName")String leaderUserName,@Param("groupType")String groupType,
			  @Param("groupStyle")String groupStyle,@Param("memberCountMin")Integer memberCountMin,@Param("memberCountMax")Integer memberCountMax,
			  @Param("groupMessageTotalMin")Integer groupMessageTotalMin,@Param("groupMessageTotalMax")Integer groupMessageTotalMax,
			  @Param("createDateS")String createDateS,@Param("createDateE")String createDateE);

    int countAllGroups();

    int countTodayNewGroups(Date deadTime);
    
    int selectGroupByNameAndDateForTotal(@Param("groupName")String groupName,@Param("privacy")Integer privacy,@Param("createDateS")String createDateS,@Param("createDateE")String createDateE);
    
    List<ForumInUserGroupVo> getNearByGroupsForOtherGroup(Double minLongitude, Double maxLongitude,Double minLatitude, Double maxLatitude,String userId,Double Longitude,Double latitude,Integer distance,Integer privacySetting);
    
    Forumgroup selectGroupDetailByHuanxin(String huanxinGroupId);
    
    List<Forumgroup> selectGroupIdForSystem();
    
    int getNearByGroupsForOtherGroupForTotal(Double minLongitude, Double maxLongitude,Double minLatitude, Double maxLatitude,String userId,Double Longitude,Double latitude,Integer distance,Integer privacySetting);
    
    int selectByGroupNameForTotal(@Param("userId")String userId,@Param("groupName")String groupName);
    
}